package com.bmps.springcloud.insuredmicroservice.model.cancel.coresystem;

import com.bmps.springcloud.insuredmicroservice.model.cancel.RequestHeaderModel;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.io.Serializable;

/**
 * description:
 * 请求报文
 *
 * @author jackdaw
 * @date 2019-11-29 10:53
 */
public class RequestModel implements Serializable {
    private static final long serialVersionUID = 5415560875357557054L;
    @XStreamAlias("Header")
    private RequestHeaderModel header;
    @XStreamAlias("Request")
    private RequestBodyModel request;

    public RequestHeaderModel getHeader() {
        return header;
    }

    public void setHeader(RequestHeaderModel header) {
        this.header = header;
    }

    public RequestBodyModel getRequest() {
        return request;
    }

    public void setRequest(RequestBodyModel request) {
        this.request = request;
    }

    @Override
    public String toString() {
        return "RequestModel{" +
                "header=" + header +
                ", request=" + request +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (!(o instanceof RequestModel)) {
            return false;
        }

        RequestModel that = (RequestModel) o;

        return new EqualsBuilder()
                .append(header, that.header)
                .append(request, that.request)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(header)
                .append(request)
                .toHashCode();
    }
}
